//
//  BranddetailCell.m
//  cityStar
//
//  Created by joyban on 14-12-23.
//  Copyright (c) 2014年 tiny. All rights reserved.
//
#import "TitleView.h"
#import "BranddetailCell.h"

@implementation BranddetailCell

+(CGFloat)heightOfTableCell
{
    return 225;
}

- (void)awakeFromNib {
    // Initialization code

}

-(void)configWithBrandDetail:(BrandDetailMessage *)brand
{
    self.heardName.text = brand.name;
    [self.hearImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.icszx.com/image/c/id/%@/w/400/h/200/m/1",brand.main]] placeholderImage:[UIImage imageNamed:@"品牌详情_logo"]];
    NSMutableArray *arrayTitleList = [NSMutableArray array];
    [brand.labels enumerateObjectsUsingBlock:^(BrandLabelList *obj, NSUInteger idx, BOOL *stop) {
        [arrayTitleList addObject:obj.name];
    }];
//    NSArray *arrayTitleList = @[@"一",@"一二三四五",@"一二",@"一二三",@"一二三四",@"一二三四五",@"最想做的事是哇"];
    
    TitleView *titleView = [[TitleView alloc]initWithFrame:CGRectMake(5, 110, 310, 110) setArray:arrayTitleList];
    [self addSubview:titleView];
//    int count = 0;

    self.showView.layer.borderColor = [UIColor colorWithWhite:0.710 alpha:1.000].CGColor;
    self.showView.layer.borderWidth = 0.5;
    
//    float sized = 15;
//    float heght = 25;
//    int m = 0;
//    for (int i = 0; i<arrayTitleList.count; i++)
//    {
//        NSString *ss = [NSString stringWithFormat:@"%@",[arrayTitleList objectAtIndex:i]];
//        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 280, 25)];
//        label.font = [UIFont systemFontOfSize:14];
//        [label setLineBreakMode:NSLineBreakByWordWrapping];
//        [label setNumberOfLines:0];
//        NSString *_Detail = [NSString stringWithFormat:@"%@",ss];
//        label.text = _Detail;
//        [label sizeToFit];
//        float width = label.frame.size.width;
//        float thewidth = width + sized;
//        if(thewidth > 300)
//        {
//            sized = 15;
//            m = m +1;
//        }
//        float titleheght = (heght+5) * m;
//        UIView * titleView = [[UIView alloc]initWithFrame:CGRectMake(sized, 120+titleheght,width+20, heght)];
//        sized = titleView.frame.size.width + sized+5;
//        
//        UIImageView *imageOne = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 5, heght)];
//        imageOne.image = [UIImage imageNamed:@"tipone"];
//        UIImageView *imgaeTwo = [[UIImageView alloc]initWithFrame:CGRectMake(titleView.frame.size.width -15, 0, 15, heght)];
//        imgaeTwo.image = [UIImage imageNamed:@"tiptwo"];
//        UILabel *textLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 0, titleView.frame.size.width-20, heght)];
//        textLabel.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"tipthree"]];
//        textLabel.font = [UIFont systemFontOfSize:14];
//        textLabel.text = ss;
//        titleView.backgroundColor = [UIColor clearColor];
//        [titleView addSubview:imageOne];
//        [titleView addSubview:imgaeTwo];
//        [titleView addSubview:textLabel];
//        [self addSubview:titleView];
//    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
